package C;

import java.util.Scanner;

public class C60 {
    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);
        String input  = sc.nextLine();
        System.out.println(getResult(input));
    }

    public static int getResult(String input) {
        int ans = -1;
        for (int i = 0; i < input.length(); i++) {
            char c = input.charAt(i);
            int left = i-1,right = i+1;
            if (check(c)) {
                while(left>=0 && !check(input.charAt(left))) {
                    left--;
                }
                left++;
                while(right<input.length() && !check(input.charAt(right))) {
                    right++;
                }
                right--;
                if (left==right) {
                    continue;
                }
                ans = Math.max(ans,right-left+1);
            }
            i = right;
        }
        return ans;
    }

    public static boolean check(char c) {
        return Character.isLowerCase(c)||Character.isUpperCase(c);
    }
}
